import React, { Component } from "react";
import { Switch, Route, Redirect } from "react-router-dom";
import { ConnectedRouter } from 'connected-react-router'
import { Layout } from "antd";
import { history } from "./store";
import NativeList from "./views/native-list";
import NativeLogDetail from "./views/native-log-detail";
import WebList from "./views/web-list";
import WebLogDetail from "./views/web-detail";
import LagList from "./views/lag-list";
import LagDetail from "./views/lag-log-detail";
import LaunchList from "./views/launch-list";
import PageAnalysisList from "./views/page-analysis-list";
import PageAnalysisDetail from "./views/page-analysis-detail";
import PageH5AnalysisList from "./views/page-h5-analysis-list";
import PageH5AnalysisDetail from "./views/page-h5-analysis-detail";
import CrashList from "./views/crash-list";
import OomList from "./views/oom-list";
import NetworkList from "./views/network-list";
import ExceptionList from "./views/exception-list";
import memoryList from "./views/memory-list";
import Sider from "./common/components/Sider/Sider";
import "antd/dist/antd.css";
import "./app.scss";

class App extends Component {

  componentDidCatch(error, errorInfo) {
    console.log(error);
  }

  render() {
    return (
      <ConnectedRouter history={history}>
        <>
          <Layout style={{ height: "100%" }}>
            <Sider />
            <div className="app">
              <Switch>
                <Redirect exact from="/" to="/native-list" />
                <Route exact path="/native-list" component={NativeList} />
                <Route exact path="/native-log-detail" component={NativeLogDetail} />
                <Route exact path="/web-list" component={WebList} />
                <Route exact path="/web-detail" component={WebLogDetail} />
                <Route exact path="/crash-list" component={CrashList} />
                <Route exact path="/crash-detail" component={NativeLogDetail} />
                <Route exact path="/lag-list" component={LagList} />
                <Route exact path="/lag-log-detail" component={LagDetail} />
                <Route exact path="/page-analysis-list" component={PageAnalysisList} />
                <Route exact path="/page-analysis-detail" component={PageAnalysisDetail} />
                <Route exact path="/page-h5-analysis-list" component={PageH5AnalysisList} />
                <Route exact path="/page-h5-analysis-detail" component={PageH5AnalysisDetail} />
                <Route exact path="/launch-list" component={LaunchList} />
                <Route exact path="/oom-list" component={OomList} />
                <Route exact path="/oom-log-detail" component={NativeLogDetail} />
                <Route exact path="/exception-list" component={ExceptionList} />
                <Route exact path="/exception-log-detail" component={NativeLogDetail} />
                <Route exact path="/network-list" component={NetworkList} />
                <Route exact path="/memory-list" component={memoryList} />
              </Switch>
            </div>
          </Layout>
        </>
      </ConnectedRouter>
    );
  }
}

export default App;
